using System;

namespace FwkLight.CodeExtensions
{
  public static class ReflectionExtensions
  {
    public static bool IsSubclassOfRawGeneric ( this Type toCheck, Type generic )
    {
      while (toCheck != typeof(object) && toCheck != null)
      {
        var cur = toCheck.IsGenericType ? toCheck.GetGenericTypeDefinition() : toCheck;
        if (generic == cur)
        {
          return true;
        }
        toCheck = toCheck.BaseType;
      }
      return false;
    }
  }
}